package org.achartengine.internal.chart;

import android.graphics.Canvas;
import android.graphics.Paint;
import org.achartengine.internal.chart.BarChart;
import org.achartengine.internal.renderer.XYMultipleSeriesRenderer;

/* loaded from: classes2.dex */
public class h extends BarChart {
    public static final String a = "RangeBar";
    private static final long serialVersionUID = 1;

    @Override // org.achartengine.internal.chart.BarChart
    protected float a() {
        return 0.5f;
    }

    @Override // org.achartengine.internal.chart.BarChart, org.achartengine.internal.chart.k
    public String c() {
        return a;
    }

    h() {
    }

    public h(org.achartengine.internal.model.g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type) {
        super(gVar, xYMultipleSeriesRenderer, type);
    }

    @Override // org.achartengine.internal.chart.BarChart, org.achartengine.internal.chart.k
    public void a(Canvas canvas, Paint paint, float[] fArr, org.achartengine.internal.renderer.b bVar, float f, int i) {
        int a2 = this.d.a();
        int length = fArr.length;
        paint.setColor(bVar.b());
        paint.setStyle(Paint.Style.FILL);
        float a3 = a(fArr, length, a2);
        for (int i2 = 0; i2 < length; i2 += 4) {
            float f2 = fArr[i2];
            float f3 = fArr[i2 + 1];
            float f4 = fArr[i2 + 2];
            float f5 = fArr[i2 + 3];
            if (this.c == BarChart.Type.STACKED) {
                canvas.drawRect(f2 - a3, f5, f4 + a3, f3, paint);
            } else {
                float f6 = (i * 2 * a3) + (f2 - (a2 * a3));
                canvas.drawRect(f6, f5, f6 + (2.0f * a3), f3, paint);
            }
        }
    }

    @Override // org.achartengine.internal.chart.BarChart, org.achartengine.internal.chart.k
    protected void a(Canvas canvas, org.achartengine.internal.model.h hVar, Paint paint, float[] fArr, int i) {
        int a2 = this.d.a();
        float a3 = a(fArr, fArr.length, a2);
        for (int i2 = 0; i2 < fArr.length; i2 += 4) {
            float f = fArr[i2];
            if (this.c == BarChart.Type.DEFAULT) {
                f += ((i * 2) * a3) - ((a2 - 1.5f) * a3);
            }
            float f2 = f;
            int i3 = i2 / 2;
            a(canvas, a(hVar.c(i3 + 1)), f2, fArr[i2 + 3] - 3.0f, paint, 0.0f);
            a(canvas, a(hVar.c(i3)), f2, fArr[i2 + 1] + 7.5f, paint, 0.0f);
        }
    }
}
